import type { VxeGridProps } from '@vben/plugins/vxe-table';

import type { VbenFormProps } from '#/adapter/form';

import { $t } from '@vben/locales';

// 表格参数定义
export const gridSchemas: VxeGridProps<any> = {
  toolbarConfig: {
    perfect: true,
    buttons: [
      { code: 'myInsert', name: '新增' },
      {
        code: 'mark_cancel',
        name: '删除',
        status: 'danger',
      },
      { code: 'save', name: '提交', status: 'success' },
    ],
  },
  columns: [
    { type: 'checkbox', width: 50 },
    { title: $t('common.seq'), type: 'seq', width: 50 },
    {
      field: 'name',
      title: $t('devOperation.ops.defInterfaceProperty.name'),
      editRender: { name: 'input', attrs: { placeholder: '请输入' } },
    },
    {
      field: 'key',
      title: $t('devOperation.ops.defInterfaceProperty.key'),
      editRender: { name: 'input', attrs: { placeholder: '请输入' } },
    },
    {
      field: 'value',
      title: $t('devOperation.ops.defInterfaceProperty.value'),
      editRender: { name: 'input', attrs: { placeholder: '请输入' } },
    },
    {
      field: 'remarks',
      title: $t('devOperation.ops.defInterfaceProperty.remarks'),
      editRender: { name: 'input', attrs: { placeholder: '请输入' } },
    },
    {
      title: $t('common.column.action'),
      width: 100,
      fixed: 'right',
      slots: { default: 'operate' },
    },
  ],
};
// 搜索表单参数定义
export const searchFormSchemas: VbenFormProps = {
  schema: [
    {
      component: 'Input',
      fieldName: 'name',
      label: $t('devOperation.ops.defInterfaceProperty.name'),
      componentProps: {
        placeholder: '请输入',
        allowClear: true,
      },
    },
    {
      component: 'Input',
      fieldName: 'key',
      label: $t('devOperation.ops.defInterfaceProperty.key'),
      componentProps: {
        placeholder: '请输入',
        allowClear: true,
      },
    },
    {
      component: 'Input',
      fieldName: 'value',
      label: $t('devOperation.ops.defInterfaceProperty.value'),
      componentProps: {
        placeholder: '请输入',
        allowClear: true,
      },
    },
  ],
};
